package com.chenfan.mcn.exception;

import com.chenfan.common.exception.ResultState;

/**
 * RPC调用响应结果错误码
 *
 * @author wulg
 * @date 2021-11-02
 **/
public enum RpcResultErrorCode implements ResultState {

    // 操作成功
    SUCCESS(0, "操作成功"),
    SUCCESS_OLD(200, "操作成功"),
    // 操作失败
    FAILED(-1, "操作失败"),


    /************************** baseinfo **************************/

    TARGET_CUSTMOER_EXCEED_LIMIT(161011, "客户数据转移失败-目标用户负责客户数量超出限制");

    private final int code;

    private String message;

    RpcResultErrorCode(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public RpcResultErrorCode format(String key) {
        this.message = String.format(this.message, key);
        return this;
    }

    @Override
    public int code() {
        return this.code;
    }

    @Override
    public String message() {
        return this.message;
    }
}
